trait Measurable {
    def area(var self : Self) : Double;
}

record Circle {
    x : Double;
    y : Double;
    r : Double;
}

record Rectangle {
    x : Double;
    y : Double;
    w : Double;
    h : Double;
}

implement Measurable for Circle {
    def area(var self : Self) : Double {
        return 3.1415926 * self.r * self.r;
    }
}

implement Measurable for Rectangle {
    def area(var self : Self) : Double {
        return self.w * self.h;
    }
}

var c = Circle(0.0, 0.0, 1.0);
var d = Rectangle(0.0, 0.0, 3.3, 5.5);
print(c.area());
print(d.area());
